package src;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * Created by dell on 2017/7/25.
 */
public class IteratorTest {
    public static void main(String[] args) {
        Collection c=new ArrayList();
        c.add("hei");
        c.add("he");
        c.add("哈哈哈哈哈");
        Iterator it=c.iterator();
        while(it.hasNext()){
            String book=(String)it.next();
            System.out.println(book);
            if (book.equals("he"))
            {
                it.remove();
            }
            book="测试字符串";
            System.out.println(book);
        }
        System.out.println(c);
    }
}
